package com.dream.testtubebaby.adapter;

import java.util.List;

import android.content.Context;
import android.widget.ImageView;

import com.dream.testtubebaby.R;
import com.dream.testtubebaby.data.doctor.Doctor;
import com.dream.testtubebaby.utils.AppUtil;
import com.dream.testtubebaby.utils.ImageLoader;
import com.dream.testtubebaby.utils.ViewHolder;

public class HomeDoctorAdapter extends CommonAdapter<Doctor> {

	public HomeDoctorAdapter(Context context, List<Doctor> mDatas,
			int itemLayoutId) {
		super(context, mDatas, itemLayoutId);
	}

	@Override
	public void convert(final ViewHolder helper, final Doctor item) {
		helper.setText(R.id.doctor_name, item.getName());
		helper.setText(R.id.doctor_job, item.getDesc());
		if (item.getPhoto_url() != null) {
			ImageView photo = (ImageView) helper.getView(R.id.doctor_photo);
			ImageLoader.getInstance().loadNetWorkImage(AppUtil.getCompletePhotoUrl(item.getPhoto_url()),
					photo);
		}
	}
}
